import request from '@/utils/request'
import type { MedicineQuery, MedicineForm } from '@/types/medicine'

// 获取药品列表
export function getMedicineList(params: MedicineQuery) {
  return request({
    url: '/medicine/list',
    method: 'get',
    params
  })
}

// 获取药品详情
export function getMedicineDetail(id: number) {
  return request({
    url: `/medicine/${id}`,
    method: 'get'
  })
}

// 新增药品
export function addMedicine(data: MedicineForm) {
  return request({
    url: '/medicine',
    method: 'post',
    data
  })
}

// 更新药品
export function updateMedicine(id: number, data: MedicineForm) {
  return request({
    url: `/medicine/${id}`,
    method: 'put',
    data
  })
}

// 删除药品
export function deleteMedicine(id: number) {
  return request({
    url: `/medicine/${id}`,
    method: 'delete'
  })
}

// 更新药品状态
export function updateMedicineStatus(id: number, status: string) {
  return request({
    url: `/medicine/${id}/status`,
    method: 'put',
    data: { status }
  })
}

// ... 其他接口 